<?php
	/**
	 * Toolbar helper
	 * 
	 * @package Helpers
	 * @author Anton Perkin
	 * @version 1.1
	 *
	 */
	class ToolbarsHelper extends HtmlxHelper
	{				
		/**
		 * Generates toolbar with specified buttons
		 *
		 * @param array $buttons array of buttons. Example: $buttons = array('add_button' => array('image'=>'image.gif', 'text'=>'caption', 'url'=>'url_here'));
		 * @param string $width width of toolbar, default 100%
		 */	
		public function Toolbar(array $buttons, $width = '100%', $use_help = 0, $caption = '')
		{
		    //buttons parsing
		    foreach ($buttons as &$button)
		    {
		        $button['image'] = (empty($button['image'])) ? '' : IMAGES.$button['image'];
		    }
		    
		    //jQuery toolbar
            jQuery::Toolbar('toolbar_container', $buttons);
		}
		
		/**
		 * Generates informational toolbar from an array
		 *
		 * @param array $value_array multidemensial array with [label] and [value] elements
		 */	
		public function ToolbarInfo(array $value_array)
		{
			echo '<table class="'.$this->infoToolbarTableCssClass.'" width="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="padding: 5px 15px 5px 15px">';
			foreach ($value_array as $value)
			{
				echo "<span class='$this->infoLabelSpanCssClass'>".ucfirst($value[label])."</span> - ";
				echo "<span class='$this->infoValueSpanCssClass'>".$value[value].'</span> | ';
			}
			echo '</td></tr></tbody></table>';
		}
	}
?>